<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:localization="clr-namespace:Invini.Localization;assembly=Invini.Localization"
    xmlns:local="clr-namespace:Invini.Training">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Invini.Training;component/Resource/Localization.xaml" />
    </ResourceDictionary.MergedDictionaries>


    <Style TargetType="{x:Type local:TrainingInfo}">
        <Style.Resources>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="TextWrapping" Value="Wrap" />
            </Style>
        </Style.Resources>
        
        <Setter Property="FontFamily" Value="{DynamicResource TextFontFamily}" />
        <Setter Property="FontSize" Value="16" />
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Background" Value="#fffcac" />
        <Setter Property="Padding" Value="20" />
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect BlurRadius="20"
                                                    Color="Black"
                                                    Direction="225"
                                                    Opacity="0.6"
                                                    ShadowDepth="0" />
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TrainingInfo}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid>
                            <Grid SnapsToDevicePixels="True"
                                  Effect="{TemplateBinding Effect}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Border Grid.Row="1"
                                        Grid.Column="1"
                                        Background="{TemplateBinding Background}"
                                        SnapsToDevicePixels="true"
                                        CornerRadius="5" />
                                
                                <Path Fill="{TemplateBinding Background}"
                                      Stretch="None"
                                      SnapsToDevicePixels="True"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      Name="arrow" />
                            </Grid>
                            
                            <Grid Margin="10"
                                  Name="grid">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                
                                <ContentPresenter Content="{TemplateBinding Content}" />
                                <Button Grid.Row="1"
                                        FontFamily="{DynamicResource LabelFontFamily}"
                                        FontSize="14"
                                        Padding="5"
                                        Cursor="Hand"
                                        HorizontalAlignment="Center"
                                        Margin="0,15,0,0"
                                        Name="button" />
                            </Grid>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Button" Value="None">
                            <Setter TargetName="button" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="Button" Value="Continue">
                            <Setter TargetName="button" Property="Content" Value="{localization:Localize Set={StaticResource Continue}, DefaultContent='Continue'}" />
                        </Trigger>
                        <Trigger Property="Button" Value="OK">
                            <Setter TargetName="button" Property="Content" Value="{localization:Localize Set={StaticResource OK}, DefaultContent='OK'}" />
                        </Trigger>
                        <Trigger Property="Button" Value="Start">
                            <Setter TargetName="button" Property="Content" Value="{localization:Localize Set={StaticResource StartTutorial}, DefaultContent='Start the tutorial'}" />
                        </Trigger>
                        <Trigger Property="Button" Value="Quit">
                            <Setter TargetName="button" Property="Content" Value="{localization:Localize Set={StaticResource QuitTutorial}, DefaultContent='Quit the tutorial'}" />
                        </Trigger>

                        <Trigger Property="Placement" Value="Center">
                            <Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="Placement" Value="Left">
                            <Setter TargetName="arrow" Property="Grid.Column" Value="2" />
                            <Setter TargetName="arrow" Property="Grid.Row" Value="1" />
                            <Setter TargetName="arrow" Property="Data" Value="M 0,0 L 0,20 L 15,10 Z" />
                            <Setter TargetName="grid" Property="Margin" Value="10,10,25,10" />
                        </Trigger>
                        <Trigger Property="Placement" Value="Top">
                            <Setter TargetName="arrow" Property="Grid.Column" Value="1" />
                            <Setter TargetName="arrow" Property="Grid.Row" Value="2" />
                            <Setter TargetName="arrow" Property="Data" Value="M 0,0 L 20,0 L 10,15 Z" />
                            <Setter TargetName="grid" Property="Margin" Value="10,10,10,25" />
                        </Trigger>
                        <Trigger Property="Placement" Value="Right">
                            <Setter TargetName="arrow" Property="Grid.Column" Value="0" />
                            <Setter TargetName="arrow" Property="Grid.Row" Value="1" />
                            <Setter TargetName="arrow" Property="Data" Value="M 15,0 L 15,20 L 0,10 Z" />
                            <Setter TargetName="grid" Property="Margin" Value="25,10,10,10" />
                        </Trigger>
                        <Trigger Property="Placement" Value="Bottom">
                            <Setter TargetName="arrow" Property="Grid.Column" Value="1" />
                            <Setter TargetName="arrow" Property="Grid.Row" Value="0" />
                            <Setter TargetName="arrow" Property="Data" Value="M 0,15 L 20,15 L 10,0 Z" />
                            <Setter TargetName="grid" Property="Margin" Value="10,25,10,10" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
